package com.helper;

import org.reflections.Reflections;
import org.reflections.scanners.FieldAnnotationsScanner;
import org.reflections.scanners.SubTypesScanner;
import org.reflections.util.ConfigurationBuilder;

import java.util.Set;

public class ReflactionHelper {



    public static <T> Set<Class<? extends T>> getReflectionClass(Class<T> type,String path){

        Reflections reflections = new Reflections(new ConfigurationBuilder().forPackages(path)
                .addScanners(new SubTypesScanner()).addScanners(new FieldAnnotationsScanner()));

        Set<Class<? extends T>> subTypes = reflections.getSubTypesOf(type);

        return subTypes;
    }
}
